#ifndef HARDWARE_DETECTION_H
#define HARDWARE_DETECTION_H

#define HW_BUS_TYPE_PCI			0x00
#define HW_BUS_TYPE_ISA			0x01

#define HW_CLASS_LEGACY				0x00

#define HW_CLASS_MASS_STORAGE		0x01
#define HW_SUBCLASS_SCSI				0x00
#define HW_SUBCLASS_IDE					0x01
#define HW_SUBCLASS_FLOPPY				0x02
#define HW_SUBCLASS_IPI					0x03
#define HW_SUBCLASS_RAID				0x04

#define HW_CLASS_NETWORK			0x02
#define HW_SUBCLASS_ETHERNET			0x00
#define HW_SUBCLASS_TOKEN_RING		0x01
#define HW_SUBCLASS_FDDI				0x02
#define HW_SUBCLASS_ATM					0x03

#define HW_CLASS_DISPLAY			0x03
#define HW_SUBCLASS_VGA					0x00
#define HW_SUBCLASS_XGA					0x01

#define HW_CLASS_MULTIMEDIA		0x04
#define HW_SUBCLASS_VIDEO				0x00
#define HW_SUBCLASS_AUDIO				0x01

#define HW_CLASS_MEMORY				0x05
#define HW_SUBCLASS_RAM					0x00
#define HW_SUBCLASS_FLASH_MEM			0x01

#define HW_CLASS_BRIDGE				0x06
#define HW_SUBCLASS_HOST_PCI			0x00
#define HW_SUBCLASS_PCI_ISA			0x01
#define HW_SUBCLASS_PCI_EISA			0x02
#define HW_SUBCLASS_PCI_MICRO			0x03
#define HW_SUBCLASS_PCI_PCI			0x04
#define HW_SUBCLASS_PCI_PCMCIA		0x05
#define HW_SUBCLASS_PCI_NUBUS			0x06
#define HW_SUBCLASS_PCI_CARDBUS		0x07

#define HW_CLASS_SIMPLECOM			0x07
#define HW_SUBCLASS_SERIAL				0x00
#define HW_SUBCLASS_PARALLEL			0x01

#define HW_CLASS_BASE_PERIF		0x08
#define HW_SUBCLASS_PIC					0x00
#define HW_SUBCLASS_DMA					0x01
#define HW_SUBCLASS_PIT					0x02
#define HW_SUBCLASS_RTC					0x03

#define HW_CLASS_INPUT				0x09
#define HW_SUBCLASS_KEYBOARD			0x00
#define HW_SUBCLASS_PEN					0x01
#define HW_SUBCLASS_MOUSE				0x02

#define HW_CLASS_DOCKING			0x0A

#define HW_CLASS_PROCESSOR			0x0B
#define HW_SUBCLASS_386					0x00
#define HW_SUBCLASS_486					0x01
#define HW_SUBCLASS_PENTIUM			0x02
#define HW_SUBCLASS_ALPHA				0x10
#define HW_SUBCLASS_POWERPC			0x20
#define HW_SUBCLASS_COPROCESSOR		0x40

#define HW_CLASS_SERIAL_BUS		0x0C
#define HW_SUBCLASS_FIREWIRE			0x00
#define HW_SUBCLASS_ACCESS				0x01
#define HW_SUBCLASS_SSA					0x02
#define HW_SUBCLASS_USB					0x03

#define HW_CLASS_MISC				0xFF
#define HW_DONT_CARE					0xFF
#define HW_SUBCLASS_OTHER			0x80

// modeled after a pci device
typedef struct
{
	u8int present;
	u8int bus_type;
	u16int device_id;
	u16int vendor_id;
	u8int class_code;
	u8int subclass_code;
	u8int prog_if;
	u8int revision;
	u8int interrupt_pin;
	u8int	interrupt_line;
} hw_device_t;

void hw_scan(void);
void hw_add_device(u8int bus_type, u16int device_id, u16int vendor_id, u8int class_code,
							u8int subclass_code, u8int prog_if, u8int revision, u8int interrupt_pin, u8int interrupt_line);
hw_device_t* hw_find_device(u16int device_id, u16int vendor_id, u8int class_code, u8int subclass_code);

#endif
